The present invention relates to a computer, such as a microcomputer, and particularly to an improvement for preventing erroneous execution of certain types of instructions.
In recent years, application of microcomputers has been widespread, examples being IC (integrated circuit) cards and controllers. Microcomputers are sometimes used in an undesirable or severe environment, for instance where the microcomputer is subject to electrostatic charge, incorrect voltage or the like. It has therefore been required to provide a measure for preventing the erroneous operation of the microcomputers.
Where the microcomputer is incorporated in an IC card, examples of the erroneous operation include alteration of important recorded data such as a password, the remaining amount of money (in an IC card), and a stop at an undesirable position in the program.
A problem associated with the prior art microcomputer is described with reference to FIG. 1. Instructions of the microcomputer are stored in a program memory which is typically formed of a ROM (read-only-memory) 1. The contents of the program counter 2 are decoded by an address decoder 3 and instructions stored in the corresponding memory locations are read out in turn. Each instruction is retained in an instruction register 4 and output to a control unit 5, which decodes the instruction and produces a control signal for executing the instruction. The control signal is, for example, applied to a gate or gates controlling the transfer of data or clocks.
In such a microprocessor, electrostatic charge, incorrect voltage, or the like may change the control signal, so that the altered control signal no longer corresponds to the instruction. As a result, a signal of a write instruction for an EPROM (electrically programmable read only memory) or EEPROM (electrically erasable and programmable read only memory) or a signal of a stop instruction may be erroneously produced. Such an error may cause writing of erroneous data or stop of the program processing, and return to the original program may become difficult. Where the program and data are stored in the same memory, e.g., an EEPROM, at different memory locations, the program may be altered and the operation is disabled.
When a stop signal on a line 6 from the control unit 5 is made to rise to the "high" level, a gate 8 for an internal clock 7 is closed, prohibiting delivery of the signal from the clock 7 to various parts of the microcomputer, whose operation is thereby halted.